#include <stdio.h>
#include <cpar.h>
static CPARContext *pGlobalContext;
typedef struct CPARGlobalStackData{
long __CPAR_VERSION__;
 int A;
}CPARGlobalStackData;
typedef struct CPARTaskStackData_tarefa1{
CPARSemaphore* s;
int i,B;
int x;
}CPARTaskStackData_tarefa1;
static CPARGlobalStackData *pGlobalStack;

;

void CPARTask_tarefa1(CPARContext *pContext);

void CPARTask_tarefa1(CPARContext *pContextint x){CPARTaskStackData_tarefa1 *pStack; pStack = (CPARTaskStackData_tarefa1*) CPARContextStackGet(pContext);
	
	
	CPARSemaphoreCreate(CPARContextAllocatorGet(pContext),&pStack->s, 1);
}

int main(int argc, char **argv)
{ 
	CPARInit();if( CPARContextCreate( NULL, &pGlobalContext, sizeof(CPARGlobalStackData) )){  CPAR_ERROR("Falha ao alocar contexto global");  return CPAR_E_NO_MEMORY;}pGlobalStack = (CPARGlobalStackData*) CPARContextStackGet(pGlobalContext);if( CPARContextWorkPoolCreate( pGlobalContext, 3)){CPAR_ERROR("Falha ao alocar work pool");return -1;}CPAR_DEFINE_VERSION;;
	pGlobalStack->A=2;
	CPARContextTaskDispatch(pGlobalContext,2,CPARTask_tarefa1,sizeof(CPARTaskStackData_tarefa1));
	CPARContextTaskWaitAll(pGlobalContext);
return 0;}